package com.zyb.warehouse.controller;

import com.zyb.warehouse.common.Result;
import com.zyb.warehouse.entity.Auth;
import com.zyb.warehouse.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Description:权限表控制层
 */
@RestController
@RequestMapping("/auth")
public class AuthController {

    @Autowired
    private AuthService authService;

    /**
     * 查询所有给角色分配的权限菜单树
     *
     * @return
     */
    @GetMapping("/auth-tree")
    public Result getAllAuthList() {
        List<Auth> roleAuthTreeList = authService.getAllRoleAuthTree();
        return Result.ok(roleAuthTreeList);
    }
}
